#pragma once
#include <stdint.h>
/**
   * \brief Shader constants
   *
   * Each shader can have constant data associated
   * with it, which needs to be copied to a uniform
   * buffer. The client API must then bind that buffer
   * to an API-specific buffer binding when using the
   * shader for rendering.
   */
class DxvkShaderConstData {

public:

    DxvkShaderConstData();
    DxvkShaderConstData(
        size_t                dwordCount,
        const uint32_t* dwordArray);

    DxvkShaderConstData(DxvkShaderConstData&& other);
    DxvkShaderConstData& operator = (DxvkShaderConstData&& other);

    ~DxvkShaderConstData();

    const uint32_t* data() const {
        return m_data;
    }

    size_t sizeInBytes() const {
        return m_size * sizeof(uint32_t);
    }

private:

    size_t    m_size = 0;
    uint32_t* m_data = nullptr;

};

struct DxvkDescriptorSets {
    static constexpr uint32_t FsViews = 0;
    static constexpr uint32_t FsBuffers = 1;
    static constexpr uint32_t VsAll = 2;
    static constexpr uint32_t SetCount = 3;

    static constexpr uint32_t CsAll = 0;
    static constexpr uint32_t CsSetCount = 1;
};


struct DxvkBindingInfo {
    VkDescriptorType      descriptorType;   ///< Vulkan descriptor type
    uint32_t              resourceBinding;  ///< API binding slot for the resource
    VkImageViewType       viewType;         ///< Image view type
    VkShaderStageFlagBits stage;            ///< Shader stage
    VkAccessFlags         access;           ///< Access mask for the resource
    VkBool32              uboSet;           ///< Whether to include this in the UBO set

    /**
     * \brief Computes descriptor set index for the given binding
     *
     * This is determines based on the shader stages that use the binding.
     * \returns Descriptor set index
     */
    uint32_t computeSetIndex() const;

    /**
     * \brief Numeric value of the binding
     *
     * Used when sorting bindings.
     * \returns Numeric value
     */
    uint32_t value() const;

    /**
     * \brief Checks for equality
     *
     * \param [in] other Binding to compare to
     * \returns \c true if both bindings are equal
     */
    bool eq(const DxvkBindingInfo& other) const;

    /**
     * \brief Hashes binding info
     * \returns Binding hash
     */
    size_t hash() const;

};